<?php namespace framework\kernel;


class App
{

	public function run()
	{
		spl_autoload_register([$this,'autoload']);

		// 加载函数库
		require 'framework/Kernel/functions.php';


		$m = isset($_GET['m'])?$_GET['m']:'Home';
		$c = isset($_GET['c'])?$_GET['c']:'Index';
		$a = isset($_GET['a'])?$_GET['a']:'index';

		// 加载框架配置项
		C(require 'framework/Common/Config.php');

		// 加载公模板配置项
		C(require 'app/Common/Conf/Config.php');

		// 加载模型配置项
		C(require 'app/'.$m.'/Conf/Config.php');

		// var_dump(C('db_host'));
		$class = $m.'\\'.'Controller'.'\\'.$c.'Controller';

		$obj = new $class;

		$obj->$a();

 	}

 	public function autoload($class)
 	{
 		// 替换
 		$class = str_replace('\\', '/', $class);
 		//判断
 		if (substr($class,0,9)=='framework') {
 			$file = $class.'.php';
 		}else{
 			$file = 'app/'.$class.'.php';
 		}
 		require_once($file);

 	}





	
}







 ?>